Install Oracle Database 12c on centos 7

下载地址:

oracle:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

sql developer
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html

PL/SQL Developer
http://files.allroundautomations.com/plsqldev1207x64.msi


## 通过wget下载,首先需要用chrome 登陆下载Oracle安装包,然后通过chrome查看下载内容获取下载连接地址, 这个地址包含AuthParam,这个值是变的
## Oracle Database 12c Release 2 (12.2.0.1.0) for Linux x86-64 (cksum - 4170261901)

wget "http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip?AuthParam=1531550179_0b36f7a93d74a319d16d912549e8f200" -O linuxx64_12201_database.zip
## 或者
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_database.zip?AuthParam=1531550179_0b36f7a93d74a319d16d912549e8f200"

## Oracle Database 12c Release 2 Grid Infrastructure (12.2.0.1.0) for Linux x86-64 (cksum - 1523222538)  
wget "http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_gsm.zip?AuthParam=1531550996_aafa7bf31f418173242a4d5220592b4b"

## Oracle Database Gateways 12c Release 2 (12.2.0.1.0) for Linux x86-64 (cksum - 2671223080) 
wget "http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_gateways.zip?AuthParam=1531551201_626b9d693e0e19eaa903a50d34774984"

## Oracle Database 12c Release 2 Examples (12.2.0.1.0) for Linux x86-64
wget "http://download.oracle.com/otn/linux/oracle12c/122010/linuxx64_12201_examples.zip?AuthParam=1531551390_b6f3aa6b20993c7afabe834d72459cc9"

## 解压
yum install -y zip unzip
mkdir /data/install
unzip linuxx64_12201_database.zip -d /data/install/

官方帮助文档

http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html

配置计算机名,添加host解析

hostnamectl set-hostname db.test.com

cat /etc/hostname
db.test.com

sestatus

echo "127.0.0.1 db.test.com" >> /etc/hosts
echo "200.200.200.50 db.test.com" >> /etc/hosts

## 关闭防火墙和selinux , 否则安装会有问题

防火墙

firewall-cmd --get-active-zones

firewall-cmd --zone=public --add-port={1521/tcp,5500/tcp,5520/tcp,3938/tcp --permanent

firewall-cmd --reload

firewall-cmd --list-ports

安装环境

## 安装需要的包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ \
glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ \
libstdc++-devel libXext libXtst libX11 libXau libXi make sysstat

## 或者

yum install -y binutils \
compat-libcap1 \
compat-libstdc++-33 \
compat-libstdc++-33.i686 \
glibc \
glibc.i686 \
glibc-devel \
glibc-devel.i686 \
gcc \
gcc-c++ \
ksh \
libaio \
libaio.i686 \
libaio-devel \
libaio-devel.i686 \
libX11 \
libX11.i686 \
libXau \
libXau.i686 \
libXi \
libXi.i686 \
libXtst \
libXtst.i686 \
libgcc \
libgcc.i686 \
libstdc++ \
libstdc++.i686 \
libstdc++-devel \
libstdc++-devel.i686 \
libXext \
libXext.i686 \
make \
sysstat \
libxcb \
libxcb.i686 \
unixODBC \
unixODBC-devel \
zlib-devel \
zlib-devel.i686 \
nfs-utils \
net-tools \
smartmontools
## 安装sqlplus wrapb包,方便光标移动(上下键,退格键)
1
2
3
4
5
6
7
8

yum install rlwrap

cat > /home/oracle/.bash_profile << EOF
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

EOF

查看CentOS自带JDK是否已安装。命令:yum list installed |grep java

若有自带安装的JDK,如何卸载CentOS系统自带Java环境?

    卸载JDK相关文件输入:yum -y remove java-1.7.0-openjdk*

    卸载tzdata-java输入:yum -y remove tzdata-java.noarch

查看yum库中的Java安装包 命令:yum -y list java*

添加oracle用户

groupadd -g 54321 oinstall
groupadd -g 54322 dba             # 数据库管理员
groupadd -g 54323 oper            # 数据库操作员
groupadd -g 54324 backupdba       # 数据备份恢复管理员
groupadd -g 54325 dgdba           # 数据库卫士
groupadd -g 54326 kmdba           # 加密密钥管理员
groupadd -g 54327 asmdba
groupadd -g 54328 asmoper
groupadd -g 54329 asmadmin
groupadd -g 54330 racdba

useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba,asmdba,asmoper,asmadmin oracle

passwd oracle

修改内核参数

## 查看系统信息

## 默认分页大小
getconf PAGESIZE
4096

sysctl -a | grep sem
kernel.sem = 250    32000    32    128
kernel.sem_next_id = -1

sysctl -a | grep shm
kernel.shm_next_id = -1
kernel.shm_rmid_forced = 0
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
kernel.shmmni = 4096
vm.hugetlb_shm_group = 0

sysctl -a | grep file-max
fs.file-max = 96145

sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 32768    60999


## 修改内核参数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

cat >> /etc/sysctl.conf << EOF

fs.aio-max-nr = 1048576
fs.file-max = 6815744

## 4G, 大概使用系统内存的一半
kernel.shmmax = 4294967296

## kernel.shmmax/PAGESIZE
kernel.shmall = 1048576

## getconf PAGESIZE
kernel.shmmni = 4096

kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
vm.hugetlb_shm_group = 54322

EOF
## 使之生效
sysctl -p



shmmax - Half the server memory
shmmni - 4096 (or greater)
fs.file-max - 6815744 (or greater)
fs.aio-max-nr - 1048576 (or greater)
net.core.rmem_default - 262144 (or greater)
net.core.rmem_max - 4194304 or greater)
net.core.wmem_default - 262144 (or greater)
net.core.wmem_max - 1048576 (or greater)
sem - 250 32000 100 128 (or greater)
net.ipv4.ip_local_port_range - 9000 65535

注:
vm.hugetlb_shm_group 与 dba 组id一致,hugetlb_shm_group contains group id that is allowed to create SysV shared memory segment using hugetlb page

sem  4个参数依次为SEMMSL(每个用户拥有信号量最大数);
SEMMNS(系统信号量最大数);
SEMOPM(每次semopm系统调用操作数);
SEMMNI(系统辛苦量集数最大数)。
Shmmax 最大共享内存2GB, 物理内存如果小的话可以设置成512M, 即: 536870912。
Shmmni 最小共享内存 4096KB。
Shmall 所有内存大小。shmall 的大小为 kernel.shmmax/4096(getconf PAGESIZE可得到)= 3774873

一般情况下可以设置最大共享内存为物理内存的一半,如果物理内存是 2G,则可以设置最大共享内存为 1073741824,如上;如物理内存是 1G,则可以设置最大共享内存为 512 * 1024 * 1024 = 536870912;以此类推。

在redhat上最大共享内存不建议超过

4*1024*1024*1024-1=4294967295

设置完成后用命令 more /etc/sysctl.conf |grep kernel.s 检查。

kernel.shmall: 共享内存页数的最大值
Linux共享内存页大小为4KB, 共享内存段的大小都是共享内存页大小的整数倍。一个共享内存段的最大大小是16G,需要共享内存页数是
16GB/4KB=16777216KB/4KB=4194304(页)

kernel.shmmax:单个共享内存段的最大值
shmmax是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值,shmmax设置应足够大,能在一个共享内存段下容纳下整个的SGA,设置的过低可能会导致需要创建多个共享内存段,可能导致系统性能的下降 。

kernel.shmmni:共享内存段的最大数量
注意该参数不是shmmin,是shmmni,shmmin 表示内存段最小大小 )
shmmni缺省值4096 足够。
shmmax(bytes) = shmmni(page size, default 4k) * shmall (page的个数)

下面专门说说kernel.sem:对应4个值
SEMMSL、SEMMNS、SEMOPM、SEMMNI

SEMMSL: 每个信号集的最大信号数量
数据库最大 PROCESS 实例参数的设置值再加上 10 。
Oracle 建议将 SEMMSL 的值设置为不少于 100 。
SEMMNS:用于控制整个 Linux 系统中信号(而不是信号集)的最大数。
Oracle 建议将 SEMMNS 设置为:系统中每个数据库的 PROCESSES 实例参数设置值的总和,加上最大 PROCESSES 值的两倍,最后根据系统中 Oracle 数据库的数量,每个加 10 。
使用以下计算式来确定在 Linux 系统中可以分配的信号的最大数量。它将是以下两者中较小的一个值:SEMMNS 或 (SEMMSL * SEMMNI)

SEMOPM: 内核参数用于控制每个 semop 系统调用可以执行的信号操作的数量。semop 系统调用(函数)提供了利用一个 semop 系统调用完成多项信号操作的功能。一个信号集能够拥有每个信号集中最大数量的SEMMSL 信号,因此建议设置 SEMOPM 等于SEMMSL 。
Oracle 建议将 SEMOPM 的值设置为不少于 100 。
SEMMNI :内核参数用于控制整个 Linux 系统中信号集的最大数量。
Oracle 建议将 SEMMNI 的值设置为不少于 100 。 
## 设置oracle 用户限制,改文件限制:vilink
1
2
3
4
5
6
7
8
9
10
11
12
13

cat >> /etc/security/limits.conf << EOF

oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 20480
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728

EOF
1
2
3
4
5
6
cat >> /etc/pam.d/login << EOF

#session required /lib64/security/pam_limits.so
session required pam_limits.so

EOF
修改ulimit:vi /etc/profile,添加:

    if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
            ulimit -u 16384
            ulimit -n 65536
        else
            ulimit -u 16384 -n 65536
        fi
    fi

修改环境变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

cat >> /home/oracle/.bash_profile << EOF

export TMP=/tmp
export TMPDIR=\$TMP

ORACLE_HOSTNAME=db.test.com
ORACLE_UNQNAME=orcl
ORACLE_BASE=/data/oracle
ORACLE_HOME=\$ORACLE_BASE/product/db12c
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=\$ORACLE_HOME/bin:\$PATH
export PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib

alias cdob='cd $ORACLE_BASE'
alias cdoh='cd $ORACLE_HOME'
alias tns='cd $ORACLE_HOME/network/admin'
alias envo='env | grep ORACLE'

umask 022

EOF

准备安装目录

# oracle/oraInventory是存放oracle 安装日志和脚本的临时目录
# oracle/product/db12c是Oracle 软件二进制程序安装保存路径
# oracle/flush_recovery_area 数据恢复目录
# oradata 存放数据库文件

mkdir -p /data/oracle/{oradata,product/db12c,flush_recovery_area,oraInventory}

chown -R oracle:oinstall /data/oracle

chmod -R 775 /data/oracle

准备安装应答文件

db_install.rsp - 用于安装oracle二进制文件,以静默方式安装/升级数据库

dbca.rsp - 用于以静默方式安装/配置/删除数据库

netca.rsp - 用于在静默模式下为oracle数据库配置简单网络

应答文件配置在本文后面

以oracle用户登录,开始安装:

su  oracle  
cd /opt/oracle
unzip linuxx64_12201_database.zip 
export LANG="en_US"

## 安装,如果提示系统符合安装要求,可以添加-ignoreSysPreReqs

./runInstaller -force -silent -noconfig -responseFile /data/oracle/db_install.rsp

## -silent 表示以静默方式安装,不会有任何提示

## -force 允许安装到一个非空目录

## -noconfig 表示不运行配置助手netca

## -responseFile 表示使用哪个响应文件,必需使用绝对路径


## 安装成功后,以 root 用户的身份执行以下脚本:

exist

/data/oracle/oraInventory/orainstRoot.sh

/data/oracle/product/db12c/root.sh

创建数据库

## 使用应答文件创建数据
## 应答文件(dbca.rsp)配置在本文后面
dbca -silent -createDatabase  -responseFile  /data/oracle/dbca.rsp



## 通过命令行创建数据库
## 创建一个数据库 testdb ,所有管理员密码都为welcome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

dbca -silent \
-createDatabase \
-templateName General_Purpose.dbc \
-gdbName db.test.com \
-sid orcl \
-createAsContainerDatabase true \
-numberOfPdbs 1 \
-pdbName testdb \
-pdbadminUsername pdba \
-pdbadminPassword lion.net \
-SysPassword lion.net \
-SystemPassword lion.net \
-emConfiguration NONE \
-recoveryAreaDestination $ORACLE_BASE/flush_recovery_area \
-characterSet "AL32UTF8" \
-nationalCharacterSet "AL16UTF16" \
-enableArchive true \
-redoLogFileSize 100
## 登陆数据库,查看一下数据库实例的状态:

## 以 DBA 身份进入 sqlplus
$ sqlplus / as sysdba
SQL> select instance_name, status from v$instance;
SQL> show pdbs
SQL> select name from v$datafile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;



## 错误排查:

安装数据库实例的时候日志文件中显示的错误内容:
ORA-27104: system-defined limits for shared memory was misconfigured 

解决方案:修改/etc/sysctl.conf中kernel.shmall的值为536870912。

在服务器上使用sqlplus访问数据库,中文不能正常显示(显示问号) 
解决方案:导出环境变量export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"

配置监听

## 以静默方式配置监听

netca -silent -responsefile /data/oracle/netca.rsp

## 启动命令
/data/oracle/product/db12c/bin/lsnrctl start LISTENER

## 查看监听状态
lsnrctl status

启动数据库

## 启动过程,先启动监听,验证数据库管理员身份后,才能启动数据库

su - oracle         ## 切换到 oracle 用户且切换到它的环境
lsnrctl status      ## 查看监听及数据库状态
lsnrctl start       ## 启动监听
sqlplus / as sysdba ## 以 DBA 身份进入 sqlplus
SQL>startup         ## 启动 db

## 停止

su - oracle             ## 切换到 oracle 用户且切换到它的环境
lsnrctl stop            ## 停止监听
sqlplus / as sysdba     ## 以 DBA 身份进入 sqlplus
SQL>SHUTDOWN IMMEDIATE  ## 关闭 db


## 运行startup, 遇到的问题
LRM-00109: could not open parameter file '/data/oracle/product/db12c/dbs/initorcl.ora

## 解决方法
cp /data/oracle/product/db12c/dbs/init.ora /data/oracle/product/db12c/dbs/initorcl.ora

oracle 三种身份验证:

系统验证(默认首先采用的身份验证,如果当前用户是oracle管理员,就直接登陆,不需要再验证用户和密码)
密码文件验证(验证oracle管理员)
数据库验证(验证普通用户)

sqlplus登陆方式

sqlplus有几种登陆方式 比如:
> sqlplus "/as sysdba"                  --以操作系统权限认证的oracle sys管理员登陆

> sqlplus /nolog                        --不在cmd或者terminal当中暴露密码的登陆方式
SQL> conn /as sysdba
&
SQL> conn sys/password as sysdba

> sqlplus scott/tiger                   --非管理员用户登陆

> sqlplus scott/tiger@orcl              --非管理员用户使用tns别名登陆

> sqlplus sys/password@orcl as sysdba   --管理员用户使用tns别名登陆

> sqlplus                               --不显露密码的登陆方式
Enter user-name:sys
Enter password:password as sysdba       --以sys用户登陆的话 必须要加上 as sysdba 子句

创建数据库的应答文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

cat > /data/oracle/dbca.rsp << EOF

## global database name
GDBNAME = "db.test.com"

## instance database name
SID = "orcl"

CREATEASCONTAINERDATABASE = true
NUMBEROFPDBS = 1
PDBNAME = testdb
PDBADMINUSERNAME = "testuser"
PDBADMINPASSWORD = "lion.net"

## template name used to create database
TEMPLATENAME = "General_Purpose.dbc"

## password for user sys,system,
SYSPASSWORD = "lion.net"
SYSTEMPASSWORD = "lion.net"

## configure dbexpress with port 5500
EMCONFIGURATION = "DBEXPRESS"
EMEXPRESSPORT = "5500"

## password for dbsnmp user and sysman user
SYSMANPASSWORD = "lion.net"
DBSNMPPASSWORD = "lion.net"

## default directory for oracle database datafiles
DATAFILEDESTINATION = /data/oracle/oradata

## default directory for flashback data
RECOVERYAREADESTINATION = /data/oracle/flush_recovery_area

## storage used for database installation
## FS - OS filesystem
STORAGETYPE = FS

## database character set
CHARACTERSET = "AL32UTF8"

## national database character set
NATIONALCHARACTERSET = "AL16UTF16"

## listener name to register database to
LISTENERS = "LISTENER"

## specify database type
## has influence on some instance parameters
DATABASETYPE = "OLTP"

##
AUTOMATICMEMORYMANAGEMENT = "TRUE"
TOTALMEMORY = "512"

EOF

监听配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

cat > /data/oracle/netca.rsp << EOF
[GENERAL]
RESPONSEFILE_VERSION="12.2"
CREATE_TYPE="CUSTOM"
SHOW_GUI=false
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""typical""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

EOF
重启时自动启动数据库

以root用户,修改/etc/oratab的最后一行,将N改成Y,保证数据库在系统重启之后自动启动。

# vi /etc/oratab
orcl:/data/oracle/product/db12c:Y

创建自启动脚本/etc/init.d/dbora

# vi /etc/init.d/dbora

    ORA_HOME=/data/oracle/product/db12c
    ORA_OWNER=oracle
    case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" &
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" &
        rm -f /var/lock/subsys/dbora
        ;;
    esac


# EM express 开启

$ sqlplus / as sysdba
SQL> show parameter dispatchers
SQL> exec DBMS_XDB_CONFIG.setHTTPPort(5500);

# web 访问管理界面
http://200.200.200.50:5500/em

注意,登录的时候使用用户名sys,密码welcome,不指定容器名,并选择以sysdba身份登录。

http://xintq.net/2017/04/18/install-db12c-ol73/#%E9%87%8D%E5%90%AF%E6%97%B6%E8%87%AA%E5%8A%A8%E5%90%AF%E5%8A%A8%E6%95%B0%E6%8D%AE%E5%BA%93

静默安装应答文件

## 复制oracle 安装目录下的db_install.rsp

cp ./database/response/db_install.rsp ./db_install.rsp

## 简单配置
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=db.test.com
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/db12c
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba

oracle.install.db.config.starterdb.globalDBName=db.test.com
oracle.install.db.config.starterdb.SID=orc1
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1024
oracle.install.db.config.starterdb.installExampleSchemas=false

oracle.install.db.config.starterdb.password.ALL=lion.net

SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
## 详细配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455

cat > /data/oracle/db_install.rsp << EOF



####################################################################
## Copyright(c) Oracle Corporation 1998,2017. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
####################################################################


#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# - INSTALL_DB_SWONLY
# - INSTALL_DB_AND_CONFIG
# - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/data/oracle/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/data/oracle/product/db12c

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/data/oracle

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE2 : Standard Edition 2


#-------------------------------------------------------------------------------

oracle.install.db.InstallEdition=EE

SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOSTNAME=db.test.com
###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which SYSDBA and SYSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #
# group "dba", then that will be used unless specified otherwise below. #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
###############################################################################

#------------------------------------------------------------------------------
# The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=oper

#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=backupdba

#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=dgdba

#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=kmdba

#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=racdba

###############################################################################
# #
# Grid Options #
# #
###############################################################################
#------------------------------------------------------------------------------
# Specify the type of Real Application Cluster Database
#
# - ADMIN_MANAGED: Admin-Managed
# - POLICY_MANAGED: Policy-Managed
#
# If left unspecified, default will be ADMIN_MANAGED
#------------------------------------------------------------------------------
oracle.install.db.rac.configurationType=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is ADMIN_MANAGED
#
# Specify the cluster node names selected during the installation.
# Leaving it blank will result in install on local server only (Single Instance)
#
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES=

#------------------------------------------------------------------------------
# This variable is used to enable or disable RAC One Node install.
#
# - true : Value of RAC One Node service name is used.
# - false : Value of RAC One Node service name is not used.
#
# If left blank, it will be assumed to be false.
#------------------------------------------------------------------------------
oracle.install.db.isRACOneInstall=

#------------------------------------------------------------------------------
# Value is required only if oracle.install.db.isRACOneInstall is true.
#
# Specify the name for RAC One Node Service
#------------------------------------------------------------------------------
oracle.install.db.racOneServiceName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a name for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolName=pool1
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a number as cardinality for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolCardinality=2
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolCardinality=

###############################################################################
# #
# Database Configuration Options #
# #
###############################################################################

#-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE
# - DATA_WAREHOUSE
# GENERAL_PURPOSE: A starter database designed for general purpose use or transaction-heavy applications.
# DATA_WAREHOUSE : A starter database optimized for data warehousing applications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=db.test.com

#-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orc1

#-------------------------------------------------------------------------------
# Specify whether the database should be configured as a Container database.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.ConfigureAsContainerDB=

#-------------------------------------------------------------------------------
# Specify the Pluggable Database name for the pluggable database in Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.PDBName=

#-------------------------------------------------------------------------------
# Specify the Starter Database character set.
# 通常中文选择的有ZHS16GBK简体中文库,建议选择unicode的AL32UTF8国际字符集
# One of the following
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet=AL32UTF8

#------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
# 自动内存管理,也就是SGA_TARGET和PAG_AGGREGATE_TARGET都不用设置了,Oracle会自动调配两部分大小。
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=true

#-------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
# 指定Oracle自动管理内存的大小,最小是256MB
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit=1024

#-------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto
# the starter database or not.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
# 是否载入模板示例
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false

###############################################################################
# #
# Passwords can be supplied for the following four schemas in the #
# starter database: #
# SYS #
# SYSTEM #
# DBSNMP (used by Enterprise Manager) #
# #
# Same password can be used for all accounts (not recommended) #
# or different passwords for each account can be provided (recommended) #
# 设置数据库用户密码 #
###############################################################################

#------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
# 设定所有数据库用户使用同一个密码,其它数据库用户就不用单独设置了
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL=lion.net

#-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS=

#-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM=

#-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=

#-------------------------------------------------------------------------------
# Specify the PDBADMIN password required for creation of Pluggable Database in the Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.PDBADMIN=

#-------------------------------------------------------------------------------
# Specify the management option to use for managing the database.
# Options are:
# 1. CLOUD_CONTROL - If you want to manage your database with Enterprise Manager Cloud Control along with Database Express.
# 2. DEFAULT -If you want to manage your database using the default Database Express option.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.managementOption=

#-------------------------------------------------------------------------------
# Specify the OMS host to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsHost=

#-------------------------------------------------------------------------------
# Specify the OMS port to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsPort=

#-------------------------------------------------------------------------------
# Specify the EM Admin user name to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminUser=

#-------------------------------------------------------------------------------
# Specify the EM Admin password to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminPassword=

###############################################################################
# #
# SPECIFY RECOVERY OPTIONS #
# ------------------------------------ #
# Recovery options for the database can be mentioned using the entries below #
# #
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if database recovery is not required. Else
# this can be set to true.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableRecovery=

#-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
# - FILE_SYSTEM_STORAGE
# - ASM_STORAGE
# 要求指定使用的文件系统存放数据库文件还是ASM
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType=

#-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
# 使用文件系统存放数据库文件才需要指定数据文件、控制文件、Redo log的存放目录
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=

#-------------------------------------------------------------------------------
# Specify the recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
# 使用文件系统存放数据库文件才需要指定备份恢复目录
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=

#-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup=

#-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
# Example : MYORACLESUPPORT_USERNAME=abc@oracle.com
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME=

#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD=

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
# 用户是否可以设置metalink密码
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be true.
#
# Example : DECLINE_SECURITY_UPDATES=false
# False表示不需要设置安全更新,注意,在11.2的静默安装中疑似有一个BUG
# Response File中必须指定为true,否则会提示错误,不管是否正确填写了邮件地址
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=

#------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example : PROXY_HOST=proxy.domain.com
#------------------------------------------------------------------------------
PROXY_HOST=

#------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and at least 2 chars.
#
# Example : PROXY_PORT=25
#------------------------------------------------------------------------------
PROXY_PORT=

#------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_USER=username
#------------------------------------------------------------------------------
PROXY_USER=

#------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_PWD=password
#------------------------------------------------------------------------------
PROXY_PWD=

#------------------------------------------------------------------------------
# Specify the Oracle Support Hub URL.
#
# Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#------------------------------------------------------------------------------
COLLECTOR_SUPPORTHUB_URL=

EOF

参考

https://blog.csdn.net/gengyuntuo/article/details/79607595

http://xintq.net/2017/09/22/silent-install-ora12c-ol7/

https://docs.oracle.com/en/database/oracle/oracle-database/index.html

https://www.jianshu.com/p/309bb3504285?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

http://blog.csdn.net/github_39294367/article/details/77057149

http://www.gimoo.net/t/1803/5a975ea1b3e13.html

https://wiki.centos.org/HowTos/Oracle12onCentos7

http://blog.csdn.net/jssg_tzw/article/details/53402743

http://blog.csdn.net/jc_benben/article/details/69911904